<table class="table table-bordered">
    <thead>
        <tr>
            <th>#</th>
            <th>Categoria</th>
            <th>Producto</th>
            <th>Cantidad</th>
            <th>Subtotal</th>
            <th>Accion</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $n = 0;
        $total = 0;

        foreach ($decFacturaDetalleTable as $object) {
            $decFacturaDetalle = new DecFacturaDetalle();
            $decFacturaDetalle = (object) $object;

            $decProducto = new DecProducto();
            $decProducto = (object) $decFacturaDetalle->getDecProducto();

            $decCategoria = new DecCategoria();
            $decCategoria = (object) $decProducto->getDecCategoria();

            $n++;
            $total += $decFacturaDetalle->getFadSubtotal();

            echo "<tr>";
            echo "<td>{$n}</td>";
            echo "<td>{$decCategoria->getCatCategoria()}</td>";
            echo "<td>{$decProducto->getPrdNombre()}</td>";
            echo "<td>{$decFacturaDetalle->getFadCantidad()}</td>";
            echo "<td>{$decFacturaDetalle->getFadSubtotal()}</td>";
            echo "<td><button type='button' class='btn btn-xs btn-danger' onClick='deleteFacturaDetalle({$decFacturaDetalle->getFadId()})'><span class='glyphicon glyphicon-remove'></span> Eliminar</button></td>";
            echo "</tr>";
        }
        ?>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="4">TOTAL</td>
            <td colspan="2"><?php echo $total; ?></td>
        </tr>
    </tfoot>
</table> 